﻿<%@ Page Title="" Language="C#" MasterPageFile="~/user/MasterPage2.master" AutoEventWireup="true" CodeFile="Choose_A.aspx.cs" Inherits="user_Choose" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .auto-style8 {
            text-align: center;
        }
        .auto-style9 {
            width: 100%;
        }
        .auto-style11 {
            text-align: left;
            width: 718px;
        }
        .auto-style12 {
            width: 718px;
        }
        .auto-style14 {
            margin-left: 0px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="auto-style8">
        <table class="auto-style9">
            <tr>
                <td class="auto-style11">
                    <asp:Label ID="Label2" runat="server" Text="请输入商品名称"></asp:Label>
&nbsp;<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged" Width="190px"></asp:TextBox>
                    &nbsp;
                    <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="查询" CssClass="auto-style14" Width="83px" />
                &nbsp;
                    <asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="返回" Width="84px" />
                </td>
            </tr>
            <tr>
                <td class="auto-style12">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="商品编号" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Width="951px" CellPadding="4" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:ImageField DataImageUrlField="图片" HeaderText="图片" ReadOnly="True"> 
                    <ControlStyle Height="120px" Width="120px" />
                    <ItemStyle Width="150px" />
                </asp:ImageField>
                <asp:BoundField DataField="商品名称" HeaderText="商品名称" SortExpression="商品名称" />
                <asp:BoundField DataField="价格" HeaderText="价格" SortExpression="价格" />
                <asp:BoundField DataField="商品编号" HeaderText="商品编号" ReadOnly="True" SortExpression="商品编号" Visible="False" />
                <asp:BoundField DataField="商品类型" HeaderText="商品类型" SortExpression="商品类型" Visible="False" />
                <asp:BoundField DataField="数量" HeaderText="数量" SortExpression="数量" Visible="False" />
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="Button2" runat="server" CausesValidation="false" CommandName="add" OnClick="Button2_Click" Text="添加购物车" CommandArgument='<%# Eval("商品编号") %>' OnClientClick="javascript:return confirm('已添加');" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
                </td>
            </tr>
        </table>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:keshe2ConnectionString %>" 
        SelectCommand="SELECT 商品名称, 价格, 商品编号, 商品类型, 数量, 图片 FROM 商品 WHERE (商品类型 = 'A') AND 数量 !=0"></asp:SqlDataSource>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</asp:Content>

